package com.beerandjesus.sportofkings.handicapper.dao;

import com.beerandjesus.sportofkings.handicapper.model.TurfSire;
import com.beerandjesus.sportofkings.handicapper.model.JockeyRating;

import java.util.List;

/**
 * Date: Jun 8, 2012
 * Time: 12:33:34 PM
 */
public interface Database {

    /**
     * Enumeration defining all possible datasources
     */
    enum Datasource {
        TURF_SIRE, JOCKEY
    }

    /**
     * Get the count of rows in the jockey rating database
     * @return The row count
     */
    int getJockeyRatingDatabaseRowCount();

    /**
     * Destroy the jockey rating database and recreate its structure
     */
    void rebuildJockeyRatingDatabase();

    /**
     * Get a TurfSire by its name. The turf sire database has only known
     * sires whose foals have turf win percentages of 15% or higher. Or
     * something like that.
     * @param name The sire name
     * @return The TurfSire if found, otherwise null
     */
    TurfSire getTurfSireByName(String name);

    /**
     * Get a jockey rating by jockey's name.
     * @param jockeyName The name of the jockey
     * @return The JockeyRating if found, otherwise null
     */
    JockeyRating getJockeyRatingByName(String jockeyName);

    /**
     * Save a jockey rating
     * @param jockeyRating The rating to save
     */
    void save(JockeyRating jockeyRating);

    /**
     * Save a bunch of jockey ratings
     * @param jockeyRatings A list of ratings to save
     */
    void save(List<JockeyRating> jockeyRatings);

    /**
     * Get all jockey ratings
     * @return A list of all jockey ratings
     */
    List<JockeyRating> getAllJockeyRatings();


    /**
     * Initialize the database.
     */
    void init();
}

